package com.example.anliku.controller;

import com.example.anliku.entity.Exampletype;
import com.example.anliku.entity.Message;
import com.example.anliku.service.ExampletypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "案例类别模块")
@RestController
@RequestMapping("/api/exampleType")
public class ExampleTypeController {
    @Resource
    private ExampletypeService exampletypeService;

    @ApiOperation(value = "添加案例类别")
    @PostMapping("/one")
    public Message insert(Exampletype exampletype) {
        return exampletypeService.insertSelective(exampletype);
    }

    @ApiOperation(value = "删除案例类别")
    @DeleteMapping("/delete")
    public Message delete(Integer exampleTypeCategoryId) {
        return exampletypeService.deleteByPrimaryKey(exampleTypeCategoryId);
    }

    @ApiOperation(value = "修改案例类别")
    @PostMapping("/put")
    public Message update(Exampletype exampletype) {
        return exampletypeService.updateByPrimaryKeySelective(exampletype);
    }

    @ApiOperation(value = "获取所有案例类别")
    @GetMapping("/all")
    public Message selectAll(){
        return exampletypeService.selectAll();
    }

    @ApiOperation(value = "根据类别id获取案例类别")
    @GetMapping("/one")
    public Message selectByPrimaryKey(Integer exampleTypeCategoryId){
        return exampletypeService.selectByPrimaryKey(exampleTypeCategoryId);
    }
}
